<!--
 * @Descripttion: 
 * @Version: 1.0
 * @Author: wcl
 * @Date: 2023-11-21 16:54:39
 * @LastEditors: wcl
 * @LastEditTime: 2023-11-24 16:47:15
-->
<template>
    <div class="container">
        <a-space direction="vertical" style="width: 100%" :size="16">
            <a-card style="width: 100%" title="客服电话配置">
                <div>配置客服电话号码，商家或客服有紧急问题时可直接拨打电话反馈。</div>
                <div class="rule" v-for="(item,index) in list" :key="index">
                    <div class="server-phone">
                        <div>客服电话{{ index+1 }}</div>
                        <a-popconfirm title="您是否要删除此条数据?" ok-text="是" cancel-text="否" @confirm="confirm(index)">
                            <a-button danger type="primary" v-if="item.isDel">删除</a-button>
                        </a-popconfirm>
                    </div>
                    <div class="consume">
                        <a-input :style="inputStyle" v-model="item.phone" maxlength="11" type="number" />
                    </div>
                    <div style="margin-top:10px">
                        <a-button type="primary">保存</a-button>
                    </div>
                </div>
                <div style="margin-top:20px">
                    <a-button style="width: 200px;" @click="handelAddServer">
                        <template #icon>
                            <UserAddOutlined />
                            新增客服电话
                        </template>
                    </a-button>
                </div>

            </a-card>
        </a-space>
    </div>
</template>
  <script setup>
import { ref, reactive } from 'vue'
const inputStyle = reactive({
    width: '300px',
    margin: ' 0 10px',
})
const list = ref([
    {
        phone: '',
        isDel: false,
    },
])
const handelAddServer = () => {
    list.value.push({ phone: '', isDel: true })
}
const confirm = (index)=>{
    list.value.splice(index,1)
}
</script>
  <style lang="less" scoped>
.rule {
    padding: 10px;
    background: #ececec;
    margin-top: 25px;
    .consume {
        margin-top: 10px;
    }
}
.server-phone {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
</style>